{include file="public/header"/}
</head>
<body>
<div class="layui-form">
    <div class="layui-fluid">
        <div class="layui-col-sm12">
            <div class="layui-card pcf30">
                    <input type="hidden" name="role_id" value="{$admininfo.role_id}"/>
                    <input type="hidden" name="admin_id" value="{$admininfo.admin_id}"/>
                    <input type="hidden" name="user_name" value="{$admininfo.user_name}"/>
                    <div class="layui-form-item">
                        <label class="layui-form-label">账号:</label>
                        <div class="layui-input-inline pcfcms_layui-input-inline" style="line-height:36px;color:red;">
                            {$admininfo.user_name}
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码:</label>
                       <div class="layui-input-inline pcfcms_layui-input-inline">
                            <input name="password"  type="password" class="layui-input" maxlength="20" lay-verType="tips"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">昵称:</label>
                        <div class="layui-input-inline pcfcms_layui-input-inline">
                            <input name="pen_name" placeholder="请输入昵称" value="{if $admininfo}{$admininfo.pen_name}{else/}{/if}" type="text" class="layui-input" maxlength="20" lay-verType="tips" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">手机:</label>
                        <div class="layui-input-inline pcfcms_layui-input-inline">
                            <input name="mobile" placeholder="请输入手机" value="{if $admininfo}{$admininfo.mobile}{else/}{/if}" type="text" class="layui-input" maxlength="20" lay-verType="tips" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">邮箱:</label>
                        <div class="layui-input-inline pcfcms_layui-input-inline">
                            <input name="email" placeholder="请输入邮箱" value="{if $admininfo}{$admininfo.email}{else/}{/if}" type="text" class="layui-input" maxlength="20" lay-verType="tips" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">性别</label>
                        <div class="layui-input-inline pcfcms_layui-input-inline">
                            <input type="radio" name="sex" value="男" title="男" {if $admininfo}{if ($admininfo.sex == "男")}checked{/if}{else/}checked{/if}/>
                            <input type="radio" name="sex" value="女" title="女" {if $admininfo}{if ($admininfo.sex == "女")}checked{/if}{else/}{/if}/>
                        </div>
                    </div>
                    {if $admininfo}
                    <div class="layui-form-item">
                        <label class="layui-form-label"></label>
                        <div class="layui-form-mid layui-word-aux"><span style="color:red;">注意：</span>编辑账号的时候，如果密码为空则是不修改密码，否则，就是修改密码</div>
                    </div>
                    {/if}
                    <div class="pcfclear"></div>
            </div>
        </div>
    </div>
    <div class="submit-info text-center">
        <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
    </div>
</div>
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
            form.on('submit(formSubmit)', function(data){
                layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
                $.ajax({
                    type : 'post',
                    url : "{:url('/admin/userinfo')}",
                    data : data.field,
                    dataType : 'json',
                    success : function(res){
                        layer.closeAll('loading');
                        if(res.status){
                            layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                                window.location.reload();
                            });
                        }else{
                            layer.msg(res.msg, {icon: 2, time: 1000});
                        }
                    },
                    error: function(e){
                        layer.closeAll('loading');
                        layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                    }
                });
                return false;
            })
    });
</script>
</body>
</html>